package com.ebupt.migu.music.unifyAudit.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import java.util.Arrays;

/**
 * 审核结果枚举
 * @author tz
 */
@JsonFormat(
        shape = JsonFormat.Shape.OBJECT
)
@Getter
public enum AuditResultType {
    /*
     * 违规
     */
    REJECT("REJECT","违规"),
    /*
     * 疑似
     */
    REVIEW("REVIEW","疑似"),
    /*
     * 正常
     */
    NORMAL("NORMAL","正常");
    /**
     * 编码
     */
    private String code;
    /**
     * 描述
     */
    private String name;

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    AuditResultType(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public static String getCodeByName(String name){
        return Arrays.stream(AuditResultType.values()).filter(e -> e.getName().equals(name)).findFirst().get().getCode();
    }

    public static String getNameByCode(String code){
        return Arrays.stream(AuditResultType.values()).filter(e -> e.getCode().equals(code)).findFirst().get().getName();
    }

}
